package com.gitee.cirnochat.user.model.vo.req.user;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
@Schema(description = "用户邮箱-重置/设置密码信息DTO")
public class UserEmailResetPasswordRequest {
    @Schema(description = "邮箱", example = "john.doe@example.com")
    @Email(message = "邮箱格式不正确")
    @NotBlank(message = "邮箱不能为空")
    @Size(max = 64, message = "邮箱长度不能超过64个字符")
    private String email;
    @Schema(description = "验证码")
    @Size(min = 6, max = 6, message = "验证码长度必须6位")
    private String code;
    @Schema(description = "旧密码")
    @Size(min = 10, max = 20, message = "旧密码长度必须在10到20位之间")
    @Pattern(regexp = "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[a-z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$",
            message = "旧密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符，长度在10到20位之间")
    private String oldPassword;
    @Schema(description = "新密码")
    @Size(min = 10, max = 20, message = "新密码长度必须在10到20位之间")
    @Pattern(regexp = "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[a-z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$",
            message = "新密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符，长度在10到20位之间")
    private String newPassword;
}
